package my.hibernate;


import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Manu
 */
@Entity
@Table (name="book")
public class Book {
    @Id
    @GeneratedValue (strategy= GenerationType.AUTO)
    @Column (name="id")
    private int id;
    
    @Column (name="title")
    private String title;
    
    @Column (name="synopsis")
    private String synopsis;
    
    @ManyToMany (mappedBy="books")
    private Set<BookCategory> categories=new HashSet<BookCategory>();

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * @return the title
     */
    public String getTitle() {
        return title;
    }

    /**
     * @param title the title to set
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * @return the synopsis
     */
    public String getSynopsis() {
        return synopsis;
    }

    /**
     * @param synopsis the synopsis to set
     */
    public void setSynopsis(String synopsis) {
        this.synopsis = synopsis;
    }

    /**
     * @return the categories
     */
    public Set<BookCategory> getCategories() {
        return categories;
    }

    /**
     * @param categories the categories to set
     */
    public void setCategories(Set<BookCategory> categories) {
        this.categories = categories;
    }
    
}
